xcommander.lib.addEventListener('ready', function() {
	xcommander.xcommand = new XCommanderXCommand();

	//wrapper for XCommand create
	xcommander.createXCommand = function(xcommand, buildIn) {
		xcommander.xcommand.create(xcommand, buildIn);
	}

	var default_lang = xcommander.lib.storage.getItem("parser_default_lang")
	if(!default_lang){
		xcommander.lib.storage.setItem("parser_default_lang", "de");
	}


	xcommander.lib.messaging.server.addMessageListener('xcommand', function(message) {
		switch(message.data.method) {
			case 'validate':
				xcommander.xcommand.validate(message.data.xcommand, function(data) {
					message.sendResponse(data);
				});
				break;
			case 'getAll':
				xcommander.xcommand.getAll(function(data) {
					message.sendResponse(data);
				});
				break;
			case 'getEnabled':
				xcommander.xcommand.getEnabled(function(data) {
					message.sendResponse(data);
				});
				break;
		}
	});
}, false);
